package com.atguigu.pratice;

import java.util.Scanner;

public class TheNearestAncestor {
    public static void main(String[] args) {
        Scanner scanner=new Scanner(System.in);
        int a=scanner.nextInt();
        int b=scanner.nextInt();
        while(a!=b){
            if(a>b){
                a/=2;
            }else{
                b/=2;
            }
        }
        System.out.println(a);
    }
}
